<?php
ob_start(); // ให้ใช้ Header ได้
session_start();
include("include/config.inc.php");
include("include/function.php");
include("include/class.mysql.php");
mysql_select_db($db) ;
//error_reporting (0); 
if($_SESSION['varEmpty'] == "") // เปลี่ยนค่าครั้งแรกให้เป็น 0 เพื่อไว้ใช้ตอนทำ array
{
		$_SESSION['varEmpty'] = 0;
}

if($_SESSION['sendPrice'] == "") // เปลี่ยนค่าครั้งแรกให้เป็น 0 เพื่อไว้ใช้ตอนทำ array
{
		$_SESSION['sendPrice'] = 0;
}

if($_SESSION['pcount'] == "") // เปลี่ยนค่าครั้งแรกให้เป็น 0 เพื่อไว้ใช้ตอนทำ array
{
		$_SESSION['pcount'] = 0;
}

$_SESSION['sum_subtotal'] = 0; //ประกาศค่าคงที่

$_SESSION['total'] = 0; //ประกาศค่าคงที่
$_SESSION['vat'] = 0; //ประกาศค่าคงที่
//session_destroy();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="include/java.js"></script>
<script type="text/javascript" src="include/checkForm.js"></script>
<SCRIPT language=JavaScript src="include/hotmail___1025000104.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript" SRC="include/CalendarPopup.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
		var cal = new CalendarPopup();
</SCRIPT>
<title>OlizaPro ยินดีต้อนรับ</title>

<link href="default.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	background-color: #3F341E;
}
-->
</style>
<!-- LightBox -->
<link rel="stylesheet" href="css/lightbox.css" type="text/css" media="screen" />
	<script src="js/prototype.js" type="text/javascript"></script>
	<script src="js/scriptaculous.js?load=effects,builder" type="text/javascript"></script>
	<script src="js/lightbox.js" type="text/javascript"></script>
<!-- LightBox -->
<style type="text/css">
<!--
body,td,th {
	font-family: Peach TV;
}
.style17 {
	color: #FFFFFF;
	font-family: "Peach TV";
	font-size: 14;
}
.style20 {
	color: #000000
}
.style21 {color: #FFFFFF}
.style22 {
	color: #FFFFFF;
	font-size: 16;
}
.style24 {font-size: 18px}
-->
</style>
</head>

<body>
<table width="1035" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="130" height="175" valign="top" background="images/online3_01.gif"><table width="100%" height="179" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td height="71" colspan="2">&nbsp;</td>
      </tr>
      <tr>
        <td width="8%" height="108" valign="top">&nbsp;</td>
        <td width="92%" valign="top"><?
	if(isset($_SESSION['login_true_member'])) // ถ้า login สำเร็จ
	{
	?>
          <span class="style21 style24"><strong>Login :</strong></span>
          <span class="style24">
          <?=$_SESSION['login_true_member']?>
          </span><br />
          <br />
          <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td><span class="style21">-</span> <a href="./?module=member&amp;action=editForm" class="style22" id="login">แก้ไขข้อมูลสมาชิก</a><br />
                <span class="style21">-</span> <a href="./?module=member&amp;action=history" class="style21" id="login">ประวัติการสั่งซื้อ</a></td>
            </tr>
          </table>
          <span class="style21">-</span> <a href="./?module=logout" id="login"> ออกจากระบบ</a>
          <?
	}
	else
	{
	?>
          <div align="center"></div>
          <form id="form2" name="form2" method="post" action="./?module=login" style="padding: 0px; margin: 0px;">
            <table width="100%" height="131" border="0" cellpadding="0" cellspacing="0">
              <tr>
                <td><span class="defaultFont style21">Username : </span></td>
              </tr>
              <tr>
                <td height="22"><input name="user_login" type="text" id="user_login" size="15" /></td>
              </tr>
              <tr>
                <td height="13"><span class="defaultFont style21">Password : </span></td>
              </tr>
              <tr>
                <td><input name="pwd_login" type="password" id="pwd_login" size="15" /></td>
              </tr>
              <tr>
                <td><span class="style21">
                  <input name="btnLogin" type="submit" id="btnLogin" value="Login" />
                  <input name="Reset" type="reset" id="Reset" value="Clear" />
                </span></td>
              </tr>
            </table>
            <?
}
			?>
          </form></td>
      </tr>
    </table></td>
    <td width="936" valign="top" background="images/bar_1_test.jpg"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td height="33" valign="bottom">&nbsp;</td>
      </tr>
    </table></td>
  </tr>
</table>
<table width="1034" height="44" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#281C06">
  <tr>
    <td width="129" height="44" bgcolor="#281C06"><img src="images/online3_04.gif" width="129" height="27" alt="" /></td>
    <td width="905" background="images/online3_05.gif"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td bgcolor="#281C06"> &nbsp;<span class="style17"> 
          <? if(!isset($_SESSION[login_true_member])) { ?>
          <a href="./?module=register" id="topMenu">สมัครสมาชิก</a> |<a href="board.php" id="topMenu"> เว็บบอร์ด</a> |</span> <span class="style17">
          <span class="style17">
          <? } ?>
          <a href="./?module=index" id="topMenu">หน้าร้าน</a> |<a href="advise.php" id="topMenu"> ให้คำปรึกษาผลิตภัณฑ์</a> </span>|</span> <span class="style17"><a href="./admin/" id="topMenu">ผู้ดูแลระบบ</a></span></td>
      </tr>
    </table>
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="73%" height="25" bgcolor="#FFFFCC"><form id="form1" name="form1" method="post" action="./?module=search" style="padding: 0px; margin: 0px;"  onsubmit="return chk_search(this)">
  &nbsp;<img src="images/Search.png" width="28" height="24" /><span class="defaultFont"><span class="style20">ค้นหา :</span>&nbsp;
  <input name="txtSearch" type="text" id="txtSearch" size="10" />
  &nbsp;จาก&nbsp;
  <select name="searchBy" id="searchBy">
    <option value="ชื่อสินค้า">ชื่อสินค้า</option>
    <option value="รหัสสินค้า">รหัสสินค้า</option>
    <option value="ราคาสินค้า">ราคาสินค้า</option>
  </select>
  </span>
        <input type="submit" name="Submit" value="ค้นหา" />
        </form></td>
        <td width="27%"><table width="100%" height="32" border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td width="79%" bgcolor="#FFFFCC"><div align="right"><span class="defaultFont"><a href="./?module=cart"><img src="images/cart_b.gif" width="85" height="25" border="0" /></a></span></div></td>
            <td width="21%" bgcolor="#FFFFCC"><span class="defaultFont"><strong> :
              <?=$_SESSION['varEmpty']?>
            </strong></span></td>
          </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>
</table>
<table width="1034" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="129" height="357" valign="top" background="images/online3_12.gif"><table width="100%" height="140" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td height="140" valign="top" bgcolor="#281C06"><br />
          <table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#281C06">
            <tr>
              <td width="17%" height="124">&nbsp;</td>
              <td width="83%"><img src="images/bulet_orange.gif" width="13" height="9" /><span class="style20"><a href="./?module=product&amp;action=new" id="catMenu">สินค้าใหม่</a> <img src="images/new.gif" width="25" height="11" /><br />
                  <img src="images/bulet_orange.gif" width="13" height="9" /><a href="./?module=product&amp;action=hot" id="catMenu">สินค้าขายดี</a><img src="images/hot.gif" width="23" height="11" /><br />
                  <img src="images/bulet_orange.gif" width="13" height="9" /><a href="./?module=product&amp;action=all" id="catMenu">ดูสินค้าทั้งหมด</a></span><br />
                  <hr />

                  <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <?
$sqlCat = "select * from tb_category  order by c_id "; 
$resultCat = mysql_db_query($db,$sqlCat);
$NRowCat = mysql_num_rows($resultCat);
while ($rowCat = mysql_fetch_array($resultCat)) { 

			 $c_name = $rowCat["c_name"];
			 $c_id = $rowCat["c_id"];


						  ?>
			        <tr>
                      <td height="20"><img src="images/bulet_orange.gif" width="13" height="9" /><a href="./?module=product&amp;category=<?=$c_id?>" id="catMenu">
                      <?=$c_name?>
                      </a> </td>
                    </tr>  <? } ?>
                  </table>
                <img src="images/spacer.gif" width="1" height="5" /></td>
            </tr>
          </table>
          </td>
      </tr>
    </table>
      <img src="images/spacer.gif" width="1" height="1" /><br />

      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td><img src="images/online_16.gif" alt="" width="129" height="28" /><br /></td>
        </tr>
      </table>
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td height="148" valign="top" background="images/online3_12.gif"><table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="16%" height="154" bgcolor="#281C06">&nbsp;</td>
              <td width="84%"><table width="100%" height="152" border="0" cellpadding="0" cellspacing="0">
                  <tr>
                    <td height="19" bgcolor="#281C06"><span class="fontWhite"><img src="images/bulet_green.gif" width="13" height="9" /><a href="./?module=index" id="catMenu">หน้าแรก</a></span></td>
                  </tr>
                  
              <? if(!isset($_SESSION[login_true_member])) {?>
			      <tr>
                    <td height="19" bgcolor="#281C06"><span class="fontWhite"><img src="images/bulet_green.gif" width="13" height="9" /><a href="./?module=register" id="catMenu">สมัครสมาชิก</a></span></td>
                  </tr>
				  <? } ?>
                  <tr>
                    <td height="19" bgcolor="#281C06"><span class="fontWhite"><img src="images/bulet_green.gif" width="13" height="9" /><a href="./?module=pay" id="catMenu">แจ้งชำระเงิน</a></span></td>
                  </tr>
                  <tr>
                    <td height="19" bgcolor="#281C06"><span class="fontWhite"><img src="images/bulet_green.gif" width="13" height="9" /><a href="./?module=other&amp;action=how2buy" id="catMenu">วิธีการสั่งซื้อ</a></span></td>
                  </tr>
                  <tr>
                    <td height="19" bgcolor="#281C06"><span class="fontWhite"><img src="images/bulet_green.gif" width="13" height="9" /><a href="./?module=other&amp;action=how2pay" id="catMenu">วิธีการชำระเงิน</a></span></td>
                  </tr>
                  <tr>
                    <td height="19" bgcolor="#281C06"><span class="fontWhite"><img src="images/bulet_green.gif" width="13" height="9" /><a href="./?module=contactus" id="catMenu">ติดต่อเรา</a></span></td>
                  </tr>
                  <tr>
                    <td height="19" bgcolor="#281C06"><p class="fontWhite"><img src="images/bulet_green.gif" width="13" height="9" /><a href="./?module=other&amp;action=aboutus" id="catMenu">เกี่ยวกับเรา</a></p>
                      <p class="fontWhite">&nbsp;</p></td>
                  </tr>
              </table></td>
            </tr>
          </table></td>
        </tr>
    </table>
    </td>
    <td width="905" valign="top" background="images/online_bg_table_main.gif" bgcolor="#BFA711"><table width="100%" height="122" border="0" cellpadding="0" cellspacing="1" bgcolor="#BFA711">
      <tr>
        <td height="120" class="style20"><?php
	
	if(($_GET[module] == "index") || ($_GET[module] == ""))
	{
			require_once("module/index/index.inc.php");
	}
	elseif($_GET[module] == "product")
	{
	
			if($_GET[action] == "detail")
			{
					require_once("module/product/detail.inc.php");
			}
			elseif($_GET[action] == "new")
			{
					require_once("module/product/viewnew.inc.php");
			}
			elseif($_GET[action] == "hot")
			{
					require_once("module/product/viewhot.inc.php");
			}
			elseif($_GET[action] == "all")
			{
					require_once("module/product/viewall.inc.php");
			}
			$sqlCat2= "select * from tb_category  order by c_id "; 
			$resultCat2= mysql_db_query($db,$sqlCat2);
			$NRowCat2= mysql_num_rows($resultCat2);
			while ($rowCat2= mysql_fetch_array($resultCat2)) 
			{ 
					 $c_name = $rowCat2["c_name"];
					 $c_id = $rowCat2["c_id"];
					 
					if($_GET[category] == $c_id)
					{
							require_once("module/product/viewCat.inc.php");
					}
			}
	}
	elseif($_GET[module] == "cart")
	{
		if($_GET[action] == "")
		{
				require_once("module/cart/view.inc.php");
		}
		elseif($_GET[action] == "del")
		{
				require_once("module/cart/del.inc.php");
		}
		elseif($_GET[action] == "checkConfirm")
		{
				require_once("module/cart/checkConfirm.inc.php");
		}
		elseif($_GET[action] == "addCart")
		{
				require_once("module/cart/addCart.inc.php");
		}
	}
	elseif($_GET[module] == "register")
	{
		if($_GET[action] == "")
		{
				require_once("module/register/regisForm.inc.php");
		}
		elseif($_GET[action] == "regisAdd")
		{
				require_once("module/register/add.inc.php");
		}
	}
	elseif($_GET['module'] == "logout")
	{
			require_once("module/login/logout.inc.php");
	}	
	elseif($_GET['module'] == "login")
	{
			require_once("module/login/index.inc.php");
	}
	elseif($_GET['module'] == "member")
	{
			if($_GET[action] == "editForm")
			{
					require_once("module/member/editForm.inc.php");
			}
			elseif($_GET[action] == "edit")
			{
					require_once("module/member/edit.inc.php");
			}
			elseif($_GET[action] == "history")
			{
					require_once("module/member/history.inc.php");
			}
	}
	elseif($_GET['module'] == "pay")
	{
			if($_GET[action] == "")
			{
					require_once("module/pay/addForm.inc.php");
			}
			elseif($_GET[action] == "add")
			{
					require_once("module/pay/add.inc.php");
			}
	}
	elseif($_GET['module'] == "other")
	{
			if($_GET[action] == "how2buy")
			{
					require_once("module/other/how2buy.inc.php");
			}
			elseif($_GET[action] == "how2pay")
			{
					require_once("module/other/how2pay.inc.php");
			}
			elseif($_GET[action] == "faq")
			{
					require_once("module/other/faq.inc.php");
			}
			elseif($_GET[action] == "aboutus")
			{
					require_once("module/other/aboutus.inc.php");
			}
	}
	elseif($_GET['module'] == "contactus")
	{
			if($_GET[action] == "")
			{
					require_once("module/contactus/addForm.inc.php");
			}
			elseif($_GET[action] == "add")
			{
					require_once("module/contactus/add.inc.php");
			}
	}
	elseif($_GET['module'] == "forgotpass")
	{
			if($_GET[action] == "")
			{
					require_once("module/forgotpass/addForm.inc.php");
			}
			elseif($_GET[action] == "add")
			{
					require_once("module/forgotpass/add.inc.php");
			}
	}
	elseif($_GET['module'] == "search")
	{
			if($_GET[action] == "")
			{
					require_once("module/search/index.inc.php");
			}
	}
?></td>
      </tr>
    </table></td>
  </tr>
</table>
<table width="633" height="24" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
   
  </tr>
</table>
</body>
</html>
